{extend name="addon/supply/supply/view/base.html"/}
{block name="resources"}
<link rel="stylesheet" href="SUPPLY_CSS/index.css">
<Style>
	.img_size{width:100%;height:100%;}
</Style>
{/block}
{block name="main"}
{if condition="isset($supply_info['is_reopen']) && $supply_info['is_reopen']  == 3"}
<div class="expire-hint">
	<div class="expire-logo">
		<img src="SUPPLY_IMG/warning.png" >
	</div>
	<div class="expire-center">
		<h3>
			{if $supply_info['status'] == 0}
				供货商已暂停服务，无法正常营业
			{else/}
				供货商已经过期，请尽快续费
			{/if}
			{if $supply_info['cert_id'] == 0}
			<a class="ns-text-color shop_auth_apply layui-btn-radius">立即认证</a>
			{else /}
				{if $is_reopen == 1}
				<a class="ns-text-color reopen_apply layui-btn-radius">立即续费</a>
				{else/}
				<a class="ns-text-color reopen_apply_detail layui-btn-radius">立即续费</a>
				{/if}
			{/if}
		</h3>
		<p><span class="ns-red-color">剩余0天</span>（已到期）<span> 咨询电话：{$website_info.web_phone}</span></p>
	</div>
</div>
{elseif condition="isset($supply_info['is_reopen']) && $supply_info['is_reopen'] == 2"}
<div class="expire-hint">
	<div class="expire-logo">
		<img src="SUPPLY_IMG/warning.png" >
	</div>
	<div class="expire-center">
		<h3>供货商即将到期，请尽快续费
			{if $supply_info['cert_id'] == 0}
			<a class="ns-text-color shop_auth_apply layui-btn-radius">立即认证</a>
			{else /}
				{if $is_reopen == 1}
				<a class="ns-text-color reopen_apply layui-btn-radius">立即续费</a>
				{else/}
				<a class="ns-text-color reopen_apply_detail layui-btn-radius">立即续费</a>
				{/if}
			{/if}
		</h3>
		<p><span class="ns-red-color">剩余{$supply_info.expires_date}天</span> <span> 咨询电话：{$website_info.web_phone}</span></p>
	</div>
</div>
{/if}
<div class="ns-survey">
	<div class="ns-survey-left">
		<div class="ns-survey-item">
			<!-- 商家信息 -->
			<div class="ns-survey-shop">
				<div class="ns-item-pic">
					{if condition="!empty($supply_info['logo'])"}
					<img layer-src src="{:img($supply_info['logo'])}" class="img_size"/>
					{else/}
					<img layer-src src="{:img($default_img.default_supply_img)}" class="img_size"/>
					{/if}
				</div>

				<div class="ns-surver-shop-detail">
					<p class="ns-survey-shop-name">{$supply_info.title}</p>
					<p>最后登录：<span class="ns-text-color-dark-gray">{php} echo date("Y-m-d H:i:s", $supply_user_info['login_time']);{/php}</span></p>
					<p class="ns-shop-detail-label"><span>{$supply_user_info.group_name}</span></p>
					<p>主营行业：<span class="ns-text-color-dark-gray">{$supply_info.category_name ?? ''}</span></p>
					<p>供货商状态：

						<span class="ns-text-color-dark-gray">
						{if $supply_info['status'] == 0}
							<a href="{:addon_url('supply://supply/cert/index')}" class="ns-text-color-dark-gray ns-red-color">冻结</a>
						{else /}
							<span class="ns-text-color-dark-gray ns-green-color">正常</span>
						{/if}
						</span>
					</p>
					<p>认证状态：

						<span class="ns-text-color-dark-gray">
						{if $supply_info['cert_id'] == 0}
							<a href="{:addon_url('supply://supply/cert/index')}" class="ns-text-color-dark-gray ns-red-color">未认证</a>
						{else /}
							<span class="ns-text-color-dark-gray ns-text-color">已认证</span>
						{/if}
						</span>
					</p>
					<p>到期时间：
						<span class="ns-text-color-dark-gray">
						{if condition="$supply_info['expire_time'] eq 0"}
						永久
						{else/}
						{php} echo date("Y-m-d", $supply_info['expire_time']);{/php}
						{/if}
						</span>
					</p>
				</div>
			</div>

			<!-- 概况 -->
			<div class="layui-card ns-survey-info ns-card-common">
				<div class="layui-card-header">
					<div>
						<span class="ns-card-title">实时概况</span>
						<span class="ns-card-sub">更新时间：{$today}</span>
					</div>
				</div>
				<div class="layui-card-body">
					<div class="ns-survey-detail-con">
						<p class="ns-survey-detail-aco">今日订单数</p>
						<p class="ns-survey-detail-num">{$stat_day.order_pay_count}</p>
						<p class="ns-survey-detail-yesterday">昨日：{$stat_yesterday.order_pay_count}</p>
					</div>
					<div class="ns-survey-detail-con">
						<p class="ns-survey-detail-aco">今日销售金额(元)</p>
						<p class="ns-survey-detail-num">{if isset($stat_day.order_total)}{$stat_day.order_total}{else /} 0.00 {/if}</p>
						<p class="ns-survey-detail-yesterday">昨日：{if isset($stat_yesterday.order_total)}{$stat_yesterday.order_total}{else /} 0.00 {/if}</p>
					</div>
					<div class="ns-survey-detail-con">
						<p class="ns-survey-detail-aco">订单销售额(元)</p>
						<p class="ns-survey-detail-num">{$supply_stat_sum.order_total}</p>
					</div>
					<div class="ns-survey-detail-con">
					</div>
					<div class="ns-survey-detail-con">
						<p class="ns-survey-detail-aco">商品总数</p>
						<p class="ns-survey-detail-num">{$supply_stat_sum.goods_count}</p>
					</div>
					<div class="ns-survey-detail-con">
						<p class="ns-survey-detail-aco">订单总数</p>
						<p class="ns-survey-detail-num">{$supply_stat_sum.order_pay_count}</p>
					</div>

					<div class="ns-survey-detail-con"></div>
					<div class="ns-survey-detail-con"></div>
				</div>
			</div>

		</div>

        <!-- 常用功能 -->
        <div class="layui-card ns-card-common">
            <div class="layui-card-header">
                <div>
                    <span class="ns-card-title"><strong>常用功能</strong></span>
                    <span class="ns-card-sub">更新时间：</span>
                </div>
            </div>

			<div class="layui-card-body">
				<div class="ns-item-block-parent">
					<a class="ns-item-block ns-item-block-hover-a" href="{:addon_url('supply://supply/goods/addgoods')}">
						<div class="ns-item-block-wrap">
							<div class="ns-item-pic">
								<img src="SUPPLY_IMG/menu_icon/issue_good.png">
							</div>
							<div class="ns-item-con">
								<div class="ns-item-content-title">发布商品</div>
								<p class="ns-item-content-desc">发布实物商品</p>
							</div>
						</div>
					</a>
					<a class="ns-item-block ns-item-block-hover-a" href="{:addon_url('supply://supply/order/lists')}">
						<div class="ns-item-block-wrap">
							<div class="ns-item-pic">
								<img src="SUPPLY_IMG/menu_icon/order_select.png">
							</div>
							<div class="ns-item-con">
								<div class="ns-item-content-title">订单查询</div>
								<p class="ns-item-content-desc">查询系统普通订单</p>
							</div>
						</div>
					</a>
					<a class="ns-item-block ns-item-block-hover-a" href="{:addon_url('supply://supply/account/reopenlist')}">
						<div class="ns-item-block-wrap">
							<div class="ns-item-pic">
								<img src="SUPPLY_IMG/menu_icon/shop_apply.png">
							</div>
							<div class="ns-item-con">
								<div class="ns-item-content-title">供货商续签</div>
								<p class="ns-item-content-desc">供货商续签管理</p>
							</div>
						</div>
					</a>
				</div>
			</div>
        </div>

	</div>
	
	<div class="ns-survey-right">
		<!-- 客服 -->
		<div class="layui-card ns-survey-customer-service">
			<div class="ns-item-block-parent">
				<div class="ns-item-block-wrap">
					<div class="ns-item-pic">
						{if condition="$website_info.web_qrcode"}
						<img src="{:img($website_info.web_qrcode)}">
						{else/}
						<img src="__STATIC__/img/wxewm.png">
						{/if}
					</div>
					<div class="ns-item-con">
						<div class="ns-item-content-title">公众号管理</div>
						<p class="ns-item-content-desc">电话：{$website_info.web_phone}</p>
					</div>
				</div>
			</div>
		</div>
		<!-- 店铺评分 -->
		<div class="layui-card ns-survey-guide">
			<div class="layui-card-header"><span><i></i>供应商评分</span></div>
			<div class="layui-card-body">
				<a class="layui-elip" href="javascript:;">描述相符：{$supply_info.supply_desccredit} 分</a>
				<a class="layui-elip" href="javascript:;">服务态度：{$supply_info.supply_servicecredit} 分</a>
				<a class="layui-elip" href="javascript:;">配送服务：{$supply_info.supply_deliverycredit} 分</a>
			</div>
		</div>
		<!-- 网站公告 -->
		<div class="layui-card ns-survey-help">
			<div class="layui-card-header"><span><i></i>网站公告</span><a class="ns-text-color" href="{:addon_url('supply://supply/notice/lists')}">更多</a></div>
			<div class="layui-card-body">
				{foreach $notice_list as $list_k => $list_v}
				<a class="layui-elip" href="{:addon_url('supply://supply/notice/detail')}?id={$list_v.id}">
					<span class="adorn ns-bg-color">{$list_k+1}</span><span>{$list_v.title}</span>
				</a>
				{/foreach}
			</div>
		</div>
	</div>
</div>
{/block}
{block name="script"}
<script>
    var table, form, laytpl, laydate, addRenewal, repeat_flag = false;
    layui.use(['form', 'laytpl', 'laydate'], function() {
        form = layui.form;
        laytpl = layui.laytpl;
        laydate = layui.laydate;
		form.render();

        /**
         * 监听开店套餐下拉选(添加)
         */
        form.on('select(shop_group)', function (data) {        //对应lay-filter
            obj.group_id = data.value;
            moneyChange(obj);
        });

        /**
         * 监听续签年限(添加)
         */
        form.on('select(apply_year)', function (data) {        //对应lay-filter
            obj.apply_year = data.value;
            moneyChange(obj);
        });

        function moneyChange(data) {
            $.ajax({
                type: "POST",
                url: ns.url("supply://supply/Apply/getApplyMoney"),
                data: data,
                dataType: 'JSON',
                success: function(res) {
                    repeat_flag = false;

                    $(".paying-amount").text(res.data.paying_amount + '元');
                    $(".pay-amount").val(res.data.paying_amount);
                    if (res.code == 0) {
                        layer.closeAll('page');
                    }
                }
            });
        }

        //申请续签
        $(".reopen_apply").click(function () {
            location.href = ns.url("supply://supply/cert/reopen");
        });
        //编辑续签
        $(".reopen_apply_detail").click(function () {
            location.href = ns.url("supply://supply/cert/editreopeninfo");
        });
        //认证
        $(".shop_auth_apply").click(function () {
            location.href = ns.url("supply://supply/cert/index");
        });

    })
</script>
{/block}
